package day9.homework;
//b.写两个线程，一个线程打印 1-52，另一个线程打印A-Z，打印顺序是12A34B…5152Z
public
class Demo2 {
    public static
    void main(String[] args) {
        new Thread(()->{
          for (int i=1;i<53;i++){
              synchronized (Demo2.class) {
                  System.out.print(i++);
                  System.out.print(i);
                  Demo2.class.notifyAll();
                  try {
                      Demo2.class.wait();
                  } catch (InterruptedException e) {
                      throw new RuntimeException(e);
                  }
              }
          }
        }).start();
        new Thread(()->{
           for (int i=65;i<92;i++){
               synchronized (Demo2.class) {
                   System.out.print((char) i);
                   Demo2.class.notifyAll();
                   try {
                       Demo2.class.wait();
                   } catch (InterruptedException e) {
                       throw new RuntimeException(e);
                   }
               }
           }
        }).start();
    }
}
